<?php
	include('function/connection.php');
	//get Rate of money
	$sql_rate="SELECT money FROM  tbl_currency ";
	$result_rate=mysql_query($sql_rate);
	$row_rate=mysql_fetch_assoc($result_rate);
	$rate_money=$row_rate['money'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sales Print</title>
<style type="text/css" media="print">
.hide{display:none}

</style>
<script type="text/javascript">
function printpage() {
document.getElementById('printButton').style.visibility="hidden";
window.print();
document.getElementById('printButton').style.visibility="visible";  
}
</script>
</head>

<body>
<input name="print" type="button" value="Print" id="printButton" onClick="printpage()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="top">
	
	<table width="595"  cellspacing="0" cellpadding="0" id="bordertable"  border="1">
      <tr>
        <td align="left"><strong><img src="images/logo_marly.png" width="130"  height="40" />&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Payment Receipt <br /><br />
        </strong>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="67%" align="left" valign="top">&nbsp;&nbsp;&nbsp;Date: 
			  <?php
				$owe_id=$_REQUEST['owe_id'];
				$sql="SELECT * FROM tbl_owes WHERE owe_id='$owe_id'";
				$result=mysql_query($sql);
				$row=mysql_fetch_assoc($result);
				
				$mysqldate=$row['date'];
	
				$phpdate = strtotime( $mysqldate );
	
				$phpdate = date("d/m/Y",$phpdate);
				echo $phpdate;
			  ?> <br />
                <strong><br />
                &nbsp;&nbsp;&nbsp;Bill No: <?php echo $row['owe_numer'];?> </strong><br /></td>
              <td width="35%"><strong>Hay Soeung Company</strong><br />
Russian Blvd Sang Kat Toek Thla, <br />Khan Sen Sok, Phnom Penh, Cambodia<br />
Email: hay_soeng@yahoo.com<br/>
Website:&nbsp;www.haysoeungautomobile.com<br />
Tel: <span large;\>+85512 544498</span><br />&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;+85512 287899<br/>
			
		  </td>
            </tr>
          </table></td>
      </tr>
      <tr>
        <td height="90" align="left" valign="top"><br />
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="5%" align="left" valign="top"><strong>&nbsp;&nbsp;TO:</strong></td>
              <td width="95%" align="left" valign="top"><br />
              <?php 
				echo "Name: ".$row['cus_name'];
				$cus_name=$row['cus_name'];
				$sql="SELECT * FROM tbl_customers WHERE cus_name='$cus_name'";
				$result=mysql_query($sql);
				$row_cus=mysql_fetch_assoc($result);
				
				?>
				<br />
				<?php
				echo "Contact1: ".$row_cus['cus_contact1']."<br>";
				echo "Contact1: ".$row_cus['cus_contact2']."<br>";
				?></td>
            </tr>
          </table></td>
      </tr>
      <tr>
        <td align="right"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="33%" align="left" valign="top"> </td>
            <td width="67%" align="left"><br />
			<br />
              <strong>&nbsp;&nbsp;Paid Amount :&nbsp;&nbsp;<?php echo $row['paid']."$"; ?><br />
              <strong>&nbsp;&nbsp;Paid Riel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;<?php  $padi=$row['paid'];$number=$padi*$rate_money;
				echo number_format($number, 2, '.', ',') ."R"; ?><br />
                 <strong>&nbsp;&nbsp;Left Money&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;<?php echo $_REQUEST['leftMoney'].".00$";  ?><br />
              &nbsp;&nbsp;Balance &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;:&nbsp;<?php echo $row['balance']."$"; ?><br />
              &nbsp;&nbsp;Due Date&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;: 
			  
			  <?php 
			  $bal= $row['balance'];
			  if( $bal!= 0) {
			  
				  $mysqldate=$row['next_date'];
	
				  $phpdate = strtotime( $mysqldate );
		
				  $phpdate = date("d/m/Y",$phpdate);
				  echo $phpdate;
		     }
			else
				echo "NONE";
		?> <br />
              </strong>
              <br />
             <br />              &nbsp;&nbsp;&nbsp;&nbsp;</td>
          </tr>
          <tr>
            <td height="100" align="left" valign="top">&nbsp;</td>
            <td height="100" align="right" valign="bottom">Signature&nbsp;</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td align="center" bgcolor="#CCCCCC">Thank you for Business with Us </td>
      </tr>
    </table></td>
  </tr>
</table>


</body>
</html>
<